
import java.io.File;

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
/**
 *
 * @author Hoa
 */
public class ListFiles {

    public static void main(String[] args) {

        // Directory path here
        String path = "D:\\";

        String files;
        File folder = new File(path);
        File[] listOfFiles = folder.listFiles();

//        for (int i = 0; i < listOfFiles.length; i++) {
//
//            if (listOfFiles[i].isDirectory()) {
//                files = listOfFiles[i].getName();
//                System.out.println(files);
//            }
//        }
//        
        for (File fn:listOfFiles){
            if(fn.isDirectory())
            {
                System.out.println(fn.getName());
            }
        }
    }
}
